#ifndef SKYBOX_INCLUDED
#define SKYBOX_INCLUDED

#include <memory>
#include "glee/GLee.h"
#include "entity.h"
#include "geom.h"
#include <vector>
using std::vector;
class GLSLProgram;

class Skybox : public Entity
{
public:
    Skybox(GameWorld* const world);
    virtual ~Skybox();

    virtual void onPrepare(float dT);
    virtual void onRender() const;
    virtual void onPostRender();
    virtual bool onInitialize();
    virtual void onShutdown();
	virtual bool isStatic() { return true; }
    void setPosition(const Vector3& v) { m_position = v; }
    Vector3 getPosition() const { return m_position; }

    float getYaw() const { return 0.0f; }
    float getPitch() const { return 0.0f; }

    void setYaw(const float val) { }
    void setPitch(const float val) { }

    Collider* getCollider() { return m_collider; }

    EntityType getType() const { return SKYBOX; }

    virtual void onCollision(Entity* collider) { }
private:
    static GLuint m_skyboxTexID;
    static GLuint m_vertexBuffer;
    static GLuint m_texCoordBuffer;
	static GLuint m_indexBuffer;
	static GLuint m_colorBuffer;
    static std::auto_ptr<GLSLProgram> m_shaderProgram;

    void initializeVBOs();
	void generateVertices();
	void generateIndices();
	void generateTextureCoords();
    void generateVertexColors();
	void addTriangle(Triangle& triangleToAdd);
	vector<Vertex>			vertexBuffer;
    vector<unsigned int>	indexBuffer;
    vector<Color>			colorBuffer;
    vector<TexCoord>		m_texCoords;

    Vector3 m_position;
    Collider* m_collider;
};

#endif
